let ul = document.querySelector("section ul")


let xhr1 = new XMLHttpRequest()
xhr1.open("get","http://chst.vip:1234/api/getinlanddiscount")
xhr1.onload = function(){
    if(xhr1.status === 200){
        let res1 = JSON.parse(xhr1.responseText)
        console.log(res1.result)

        let lis = ''
        let regExp = /(?<=imgurl=)[^'"]*/;
        res1.result.forEach((item,index) => {
            lis += 
            `
            <li productId=${item.productId}>
                <a href="#" productId=${item.productId}>
                    
                    <div>
                    ${item.productImg}
                    </div>


                    <div class="zi">${item.productName}</div>
                    <p class="p1">${item.productPrice}</p>
                    <p class="p2">${item.productFrom}${item.productTime}</p>
                </a>
            </li>
            `
        })
        ul.innerHTML = lis

    }
}
xhr1.send(null)

$('ul').on('click','li',function(){
    let productid = $(this).attr('productid')
    console.log(productid)
    location.href = `./page3-1.html?productid=${productid}`
})